<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0,user-scalable=0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>H5编辑器</title>
    <link rel="stylesheet" href="./index.css">
</head>
<body>
    <div class="editor">
        <div class="overview">
            
        </div>
        <div class="canvas">
            <input type="text" name="" id="" placeholder="请输入入名字">
        </div>
        <div class="control-panel">
                <div>
                    <button>单行文本</button>
                    <button>多行文本</button>
                    <button>单选框</button>
                    <button>多选框</button>
                </div>

                <div class="fromtype">
                    <div class="fromitem text">
                        标题: <input type="text" name="user" class="title">
                        输入引导: <input type="text" name="user" class="placeholder">
                    </div>
                    <div class="fromitem text">
                        标题: <input type="text" name="user" class="title">
                        输入引导: <input type="text" name="user" class="placeholder">
                    </div>
                    <button onclick="save()">保存</button>
                </div>

                <div class="template" style="opacity:1">           
                    <div id="text">
                        <span>标题</span><input type="text" name="" placeholder='请输入内容'>
                    </div>
                    <div id="radio">
                        <span class="h5ui-checkbox_ft"></span> <span>8888</span>
                    </div>
                </div>
        </div>
    </div>


    <script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
    <script>
        function save(){
            let title = $('.control-panel .title').val()
            let placeholder = $('.control-panel .placeholder').val()
            let canvas = $('.canvas')
            let newformitem = $('#text').clone()
            console.log(newformitem.children('span')[0].innerHTML,newformitem.children('input')[0].placeholder,title,placeholder)
            newformitem.children('span')[0].innerHTML = title
            newformitem.children('input')[0].placeholder = placeholder
            canvas.append(newformitem)
        }        


    </script>
    
</body>
</html>